<%@page import="models.StaffModel"%>
<%@page import="admin.data.StaffData"%>
<%@page import="helpers.DateHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="models.CoordinaModel"%>
<%@page import="models.RouteModel"%>
<%@page import="java.util.List"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	List<RouteModel> listRoute = (List<RouteModel>) request.getAttribute("listRoute");
	List<CoordinaModel> listCoordina = (List<CoordinaModel>) request.getAttribute("listCoordina");
	TreeMap<String, RouteModel> mapRoute = null;
	if(request.getAttribute("mapRoute")!=null)
	{
		mapRoute = (TreeMap<String, RouteModel>) request.getAttribute("mapRoute");
	}
	StaffData staffData = new StaffData();
%>

<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>
        <div class="maincontent noright">
        	<div class="maincontentinner">
            	
                <ul class="maintabmenu">
                	<li class="current"><a href="/admin/store-item/import/">Trả hàng theo LOC</a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
                	<jsp:include page="/admin/elements/message.jsp"/>
                	<div class="contenttitle radiusbottom0">
	                	<h2 class="table"><span>Danh sách tuyến đợi trả hàng</span></h2>
	                </div> 
	                <form class="stdform" action="/admin/store-item/import/" method="post">               		
	               		<div class="one_half">                			
	               			<p>
	               				<label> Mã Tuyến </label>                        
	                            <input type="text" class="smallinput" name="coordinaId">
	                            <input type="hidden" class="smallinput" name="action" value="search">	                            
	                            <button class="radius3 apply-change">Tìm kiếm</button>                      	
	                            
	               			</p>                   	
	               		</div>           
               		</form>
               		<br clear="all" /><br />
	                <% if(listCoordina.size()>0) { %>
	                <table cellspacing="0" cellpadding="0" border="0" class="stdtable stdtablecb" id="list-table">
	                    <colgroup>
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                    </colgroup>
	                    <thead>
	                        <tr>
	                        	<th class="head0">Tên tuyến</th>
	                            <th class="head1">Mã tuyến</th>
	                            <th class="head0">Giao nhận</th>
	                            <th class="head1">Trạng thái</th>	                           
	                            <th class="head0">Thời gian cập nhật</th>	
	                            <th class="head1">Chi tiết</th>	                          
	                        </tr>
	                    </thead>
	                    <tfoot>
	                        <tr>
	                        	<th class="head0">Tên tuyến</th>
	                            <th class="head1">Mã tuyến</th>
	                            <th class="head0">Giao nhận</th>
	                            <th class="head1">Trạng thái</th>	                           
	                            <th class="head0">Thời gian cập nhật</th>
	                            <th class="head1">Chi tiết</th>	                         
	                        </tr>
	                    </tfoot>
	                    <tbody>
	                    	<% for (int i = 0; i < listCoordina.size(); i++) { %>
	                    	<tr>
	                    		<td class="center"><%=mapRoute.get(listCoordina.get(i).getRouteId()).getName() %></td> 
	                    		<td class="center"><%=listCoordina.get(i).getId() %></td>  	                      		 	
	                    		<td class="center">
	                    			<%
                    					StaffModel staff = staffData.getByCode(listCoordina.get(i).getEmployeeId());
	                    				out.print("["+listCoordina.get(i).getEmployeeId()+"] "+staff.getName());
	                    			%>
	                    			
	                    		</td>  	                       
	                    		<td class="center">Đã cập nhật giao nhận</td>  	                       
	                    		<td class="center"><%=DateHelper.dateToString(listCoordina.get(i).getCreated(),"HH:mm dd/MM/yyyy")%></td>     
	                    		<td class="center">
	                    			<a href="/admin/store-item/import/<%=listCoordina.get(i).getId() %>">Trả hàng</a>
	                    		</td>	                    			                     
	                        </tr>
	                    	<% } %>
	                    </tbody>
	                </table>
	                <% } %>	                	
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp">
            	<jsp:param name="language" value="1" />
			</jsp:include>
            
        </div><!--maincontent-->
        
<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>